package com.zwan.oam_rtc.utils.messages;

import com.zwan.oam_rtc.utils.wintcp.ByteTransfer;

import java.nio.ByteBuffer;

public class YBBindinfoResultMessage extends AbstractStruct {
    private byte[] messageBodyHeader = new byte[8];
    private byte[] callFlowId = new byte[20];
    private byte[] callBackUrl = new byte[300];
    private byte[] mainbindId = new byte[4];
    private byte[] tempbindId = new byte[4];
    private byte[] callingnumberB = new byte[29];
    private byte[] tempnumberY = new byte[30];
    private byte[] expiration = new byte[20];
    private byte[] companyid = new byte[4];

    private static int LENGTH = 419;

    /**
     * 返回消息写入buffer
     */
    @Override
    public void writeToBuffer(ByteBuffer bf) {
        bf.put(messageBodyHeader);
        bf.put(callFlowId);
        bf.put(callBackUrl);
        bf.put(mainbindId);
        bf.put(tempbindId);
        bf.put(callingnumberB);
        bf.put(tempnumberY);
        bf.put(expiration);
        bf.put(companyid);
    }

    /**
     * buffer读出返回消息
     */
    @Override
    public void readFromBuffer(ByteBuffer bf) {
        bf.get(messageBodyHeader);
        bf.get(callFlowId);
        bf.get(callBackUrl);
        bf.get(mainbindId);
        bf.get(tempbindId);
        bf.get(callingnumberB);
        bf.get(tempnumberY);
        bf.get(expiration);
        bf.get(companyid);
    }

    @Override
    public int getLength() {
        return LENGTH;
    }

    public byte[] getMessageBodyHeader() {
        return messageBodyHeader;
    }

    public void setMessageBodyHeader(byte[] messageBodyHeader) {
        this.messageBodyHeader = messageBodyHeader;
    }

    public String getCallFlowId() {
        return ByteTransfer.getString(callFlowId);
    }

    public void setCallFlowId(String callFlowId) {
        ByteTransfer.str2Byte(callFlowId, this.callFlowId);
    }

    public String getCallBackUrl() {
        return ByteTransfer.getString(callBackUrl);
    }

    public void setCallBackUrl(String callBackUrl) {
        ByteTransfer.str2Byte(callBackUrl, this.callBackUrl);
    }

    public String getMainbindId() {
        return ByteTransfer.getString(mainbindId);
    }

    public void setMainbindId(String mainbindId) {
        ByteTransfer.str2Byte(mainbindId, this.mainbindId);
    }

    public String getTempbindId() {
        return ByteTransfer.getString(tempbindId);
    }

    public void setTempbindId(String tempbindId) {
        ByteTransfer.str2Byte(tempbindId, this.tempbindId);
    }

    public String getCallingnumberB() {
        return ByteTransfer.getString(callingnumberB);
    }

    public void setCallingnumberB(String callingnumberB) {
        ByteTransfer.str2Byte(callingnumberB, this.callingnumberB);
    }

    public String getTempnumberY() {
        return ByteTransfer.getString(tempnumberY);
    }

    public void setTempnumberY(String tempnumberY) {
        ByteTransfer.str2Byte(tempnumberY, this.tempnumberY);
    }

    public String getExpiration() {
        return ByteTransfer.getString(expiration);
    }

    public void setExpiration(String expiration) {
        ByteTransfer.str2Byte(expiration, this.expiration);
    }

    public String getCompanyid() {
        return ByteTransfer.getString(companyid);
    }

    public void setCompanyid(String companyid) {
        ByteTransfer.str2Byte(companyid, this.companyid);
    }

}
